package com.mac.pojo;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

/**
 * 展示文章实体类
 */
@SuppressWarnings({"all"})
public class ArticleView {

    int articleId;
    // 文章标题
    private String title;

    // 文章内容
    private String content;

    // 作者姓名
    private String author;

    // 发布时间
    private String publishDate;

    public ArticleView() {
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public int getArticleId() {
        return articleId;
    }

    public void setArticleId(int articleId) {
        this.articleId = articleId;
    }

    public void setPublishDate(Timestamp publishDate) {
        if (publishDate != null) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            this.publishDate = sdf.format(publishDate);
        } else {
            this.publishDate = null;
        }
    }

    public String getPublishDate() {
        return publishDate;
    }

    @Override
    public String toString() {
        return "ArticleView{" +
                "articleId=" + articleId +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", author='" + author + '\'' +
                ", publishDate='" + publishDate + '\'' +
                '}';
    }
}

